package com.example.campustalent.utils

import android.content.Context
import android.content.res.ColorStateList
import androidx.core.content.ContextCompat
import com.example.campustalent.R

/**
 *@author: wangtianxiong
 *@time: 2022/3/11
 *@describe:
 *
 */
//fun BottomNavigationViewEx.init(navigationItemSelectedAction: (Int) -> Unit): BottomNavigationViewEx {
//    enableAnimation(true)
//    enableShiftingMode(false)
//    enableItemShiftingMode(true)
//    itemIconTintList = ContextCompat.getColorStateList(ContextCompat.getColor(context, R.color.main_color)))
//    itemTextColor = SettingUtil.getColorStateList(ContextCompat.getColor(context, R.color.color_5B86E5))
//    setTextSize(14F)
//    setOnNavigationItemSelectedListener {
//        navigationItemSelectedAction.invoke(it.itemId)
//        true
//    }
//    return this
//}
fun getColorStateList(context: Context): ColorStateList {
    val colors = intArrayOf(ContextCompat.getColor(context, R.color.main_color), ContextCompat.getColor(context, R.color.color_8a8a8a))
    val states = arrayOfNulls<IntArray>(2)
    states[0] = intArrayOf(android.R.attr.state_checked, android.R.attr.state_checked)
    states[1] = intArrayOf()
    return ColorStateList(states, colors)
}